# -*- coding: utf-8 -*-
import scrapy
from douban.items import DoubanItem

class DoubanspiderSpider(scrapy.Spider):
    name = 'doubanspider'
    allowed_domains = ['douban.com']
    start_urls = ['https://movie.douban.com/top250']

    def parse(self, response):
        movies = response.xpath('//*[@id="content"]/div/div[1]/ol/li')
        for movie in movies:
            name = movie.xpath('./div/div[2]/div[1]/a/span[1]/text()').extract()[0]
            item = DoubanItem()
            item['name'] = name
            yield item
